package com.example.mybatis_test.controller;


import com.example.mybatis_test.service.TeaService;
import com.example.mybatis_test.util.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ican
 * @since 2023-06-08
 */
@RestController
@RequestMapping("/tea")
public class TeaController {

    @Resource
    private TeaService teaService;


    /**
     * @api {POST} /tea/selectTeaStuList selectTeaStuList
     * @apiVersion 1.0.0
     * @apiGroup TeaController
     * @apiName selectTeaStuList
     * @apiParam (请求体) {Object} requestBody
     * @apiParamExample 请求体示例
     * {}
     * @apiSuccess (响应结果) {Object} response
     * @apiSuccessExample 响应结果示例
     * {}
     */
    @PostMapping("/selectTeaStuList")
    R selectTeaStuList(@RequestBody Map map)
    {
        Integer teaId = (Integer) map.get("teaId");
        return teaService.selectTeaStuList(teaId);
    }


    /**
     * @api {POST} /tea/selectTeaJoinStuList selectTeaJoinStuList
     * @apiVersion 1.0.0
     * @apiGroup TeaController
     * @apiName selectTeaJoinStuList
     * @apiParam (请求体) {Object} requestBody
     * @apiParamExample 请求体示例
     * {}
     * @apiSuccess (响应结果) {Object} response
     * @apiSuccessExample 响应结果示例
     * {}
     */
    @PostMapping("/selectTeaJoinStuList")
    public R selectTeaJoinStuList(@RequestBody Map map)
    {
        Integer teaId = (Integer) map.get("teaId");
        return teaService.selectTeaJoinStuList(teaId);
    }
}

